import React from 'react';
import ReactDOMServer from 'react-dom/server';
import { Provider } from 'react-redux';
import { StaticRouter as Router } from 'react-router-dom';

import store from '../../src/stores/configureStore';
import App from '../../src/container/App';

export default (ctx) => {
  const root = ReactDOMServer.renderToString(
    <Provider store={ store }>
      <Router location={ ctx.path } context={ {} }>
        <App />
      </Router>
    </Provider>,
  );
  ctx.render('index', { root });
}
